package com.api.shopapi.mapper;

import com.api.shopapi.entity.DishesPlanNoon;
import org.apache.ibatis.annotations.*;
import org.springframework.stereotype.Repository;

import java.util.List;

@Repository
@Mapper
public interface DishesPlanNoonMapper {


    @Insert("insert into dishes_plan_noon" +
            "(" +
            "DishesPlanNoonCode," +
            "DishesPlanCode" +
            ") " +
            "values" +
            "(" +
            "#{dishesPlanNoon.DishesPlanNoonCode}," +
            "#{dishesPlanNoon.DishesPlanCode}" +
            ")")
    int insert(@Param("dishesPlanNoon") DishesPlanNoon dishesPlanNoon);

    @Delete("delete from dishes_plan_noon where dishesPlanNoonCode=#{dishesPlanNoonCode}")
    int delete(@Param("dishesPlanNoonCode") String dishesPlanNoonCode);

    @Update("update dishes_plan_noon" +
            " set" +
            " DishesPlanCode=#{dishesPlanNoon.DishesPlanCode}" +
            " where " +
            " dishesPlanNoonCode=#{dishesPlanNoon.dishesPlanNoonCode}")
    int update(@Param("dishesPlanNoon") DishesPlanNoon dishesPlanNoon);

    @Select("select * from dishes_plan_noon where dishesPlanNoonCode=#{dishesPlanNoonCode} limit 1")
    DishesPlanNoon getByDishesPlanNoonCode(@Param("dishesPlanNoonCode") String dishesPlanNoonCode);

    @Select("<script>" +
            "select * from dishes_plan_noon where dishesPlanCode=#{dishesPlanCode} " +
            "</script>")
    List<DishesPlanNoon> ListByDishesPlanCode(@Param("dishesPlanCode") String dishesPlanCode);


}
